

part of httpplugin;

mixin HttpChannelMixin {
  Future<HttpResultContainer> _onCommonRequest(String path,
      Map<String, dynamic> para, {bool needToken = true,
        void Function(int? token)? cancelToken,
        int? timeEpoch, String? uuidC
      }) async{


    // todo: 未加密
    Map<String, String> header = para[HttpPluginKey.HEADER] ?? <String, String>{};
    if (needToken) {
      header["token"] = "";
    }
    // header["Accept-Language"] = AppInternational.current is $zh_CN ? "zh" : "en";
    para[HttpPluginKey.HEADER] = header;
    return HttpMidBuffer.buffer.requestWithParameter(path, para)..then((value) {
      WrapperModel wrapper = value.finalize(wrapper: WrapperModel());
      if (wrapper.code == 400) {
        CustomInstanceManager.instance.getInstance<EventBus>()?.notificationListener(name: EventBusNotifyKeys.multiDeviceLogin);
      }
    });
  }
}